@echo off
:: cd to current dir
cd /d "%~dp0"

:: git path
set path=%path%;"C:\Program Files\Git\bin\";"C:\Program Files (x86)\Git\bin\"

:: python path
set path=%path%;"%localappdata%\Programs\Python\Python36\";"%localappdata%\Programs\Python\Python36\Scripts\"

:: update
git reset --hard
git pull

:: pip mirror url
set mirror=https://mirrors.aliyun.com/pypi/simple/

:: update pip
python -m pip install --upgrade pip -i %mirror%

:: update & install pip modules
pip install -r requirements.txt -i %mirror%
pip install --upgrade -r requirements.txt -i %mirror%

:: copy config file
if not exist user\config.ini (
  copy user\examples\config.ini user\
)

:: show code version
git log -n 1

:: show done
echo ===== DONE! =====
pause
